import { message } from "antd";

export default function useMessage() {
	const [messageApi, contextHolder] = message.useMessage();

	const success = (content: string) => {
		messageApi.open({
			type: "success",
			content: content
		});
	};

	const error = (content: string) => {
		messageApi.open({
			type: "error",
			content: content
		});
	};

	const warning = (content: string) => {
		messageApi.open({
			type: "warning",
			content: content
		});
	};

	return { contextHolder, success, error, warning };
}
